﻿using System.Data.Entity;

namespace ThuySan.Bussiness
{
	public class FishesStoreContext : DbContext
	{

		public FishesStoreContext() : base("FishesStoredb")
		{
		}

		public DbSet<Property> Propertys { get; set; }
		public DbSet<ProductProperty> ProductPropertys { get; set; }
		public DbSet<CategoryProperty> CategoryPropertys { get; set; }
		public DbSet<Product> Products { get; set; }
		public DbSet<Tag> Tags { get; set; }
        public DbSet<Setting> Settings { get; set; }
		public DbSet<ProductTag> ProductTags { get; set; }
		public DbSet<CategoryTag> CategoryTags { get; set; }
		public DbSet<WebUser> WebUsers { get; set; }
		public DbSet<Category> Categorys { get; set; }
        public DbSet<Image> Images { get; set; }
        public DbSet<EmailTemplate> EmailTemplates { get; set; }

		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			// Table: Property
			modelBuilder.Entity<Property>().ToTable("Property", "dbo");
			modelBuilder.Entity<Property>().HasKey(c => new { c.PropertyId });
			// Table: ProductProperty
			modelBuilder.Entity<ProductProperty>().ToTable("ProductProperty", "dbo");
			modelBuilder.Entity<ProductProperty>().HasKey(c => new { c.ProductPropertyId });
			// Table: CategoryProperty
			modelBuilder.Entity<CategoryProperty>().ToTable("CategoryProperty", "dbo");
			modelBuilder.Entity<CategoryProperty>().HasKey(c => new { c.CategoryPropertyId });
			// Table: Product
			modelBuilder.Entity<Product>().ToTable("Product", "dbo");
			modelBuilder.Entity<Product>().HasKey(c => new { c.ProductId });
			// Table: Tag
			modelBuilder.Entity<Tag>().ToTable("Tag", "dbo");
			modelBuilder.Entity<Tag>().HasKey(c => new { c.TagId });
            // Table: Setting
            modelBuilder.Entity<Setting>().ToTable("Setting", "dbo");
            modelBuilder.Entity<Setting>().HasKey(c => new { c.SettingId });
			// Table: ProductTag
			modelBuilder.Entity<ProductTag>().ToTable("ProductTag", "dbo");
			modelBuilder.Entity<ProductTag>().HasKey(c => new { c.ProductTagId });
			// Table: CategoryTag
			modelBuilder.Entity<CategoryTag>().ToTable("CategoryTag", "dbo");
			modelBuilder.Entity<CategoryTag>().HasKey(c => new { c.Id });
			// Table: WebUser
			modelBuilder.Entity<WebUser>().ToTable("WebUser", "dbo");
			modelBuilder.Entity<WebUser>().HasKey(c => new { c.WebUserId });
			// Table: Category
			modelBuilder.Entity<Category>().ToTable("Category", "dbo");
			modelBuilder.Entity<Category>().HasKey(c => new { c.CategoryId });
            // Table: Image
            modelBuilder.Entity<Image>().ToTable("Image", "dbo");
            modelBuilder.Entity<Image>().HasKey(c => new { c.Id });
            // Table: EmailTemplate
            modelBuilder.Entity<EmailTemplate>().ToTable("EmailTemplate", "dbo");
            modelBuilder.Entity<EmailTemplate>().HasKey(c => new { c.Id });
		}

	}
}
